<template>
  <div class="container">
    <img class="img" v-lazy="data.cartImg" />
    <div class="content">
      <div class="title">{{data.title}}</div>
      <div class="bottom">
        <div class="price">
          <span class="now-price">￥{{data.nowPrice}}</span>
          <span class="old-price">￥{{data.oldPrice}}</span>
        </div>
        <span class="inventory">{{data.buyNum}}人购买</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'GoodListItem',
  props: {
    data: Object,
  },
};
</script>

<style scoped>
  .container {
    display: flex;
    flex-direction: row;
    width: 90%;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    height: 6rem;
  }
  .img {
    width: 5rem;
    height: 5rem;
    margin-left: 1rem;
    margin-top: 0.5rem;
    flex: none;
  }
  img[lazy=loading] {
    height: 5rem;
    margin-left: 1rem;
    margin-top: 0.5rem;
    background: #999;
  }
  .content {
    display: flex;
    flex: auto;
    height: 5rem;
    margin-right: 0.5rem;
    margin-left: 0.5rem;
    margin-top: 0.5rem;
    flex-direction: column;
    justify-content: space-between;
  }
  .title{
    font-size: 0.65rem;
    color: #333333;
    align-items: center;
  }
  .bottom{
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
  }
  .price{
    display: flex;
    flex-direction: row;
    align-items: center;
  }
  .now-price{
    font-size: 0.75rem;
    color: red;
  }
  .old-price{
    font-size: 0.65rem;
    color: #7e8c8d;
    text-decoration-line: line-through;
    margin-left: 0.1rem;
  }
  .inventory{
    font-size: 0.35rem;
    color: #7e8c8d;
    margin-left: 0.1rem;
    margin-top: 0.1rem;
  }
</style>
